﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using My.Pattern.Factory;

namespace My.Web.MVC.V4.Factory
{
    public class SessionDataFactory:DataFactory
    {
        private Controller _containerController;

        public SessionDataFactory(Controller controller)
        {
            _containerController = controller;
        }

        public override T Retrieve<T>(string key)
        {
            return (T)_containerController.Session[key];
        }

        public override void Archive(string key, object value)
        {
            _containerController.Session[key] = value;
        }        
    }
}